package com.twentytwok.hospitalsystem22K.controller;

import com.twentytwok.hospitalsystem22K.common.Code;
import com.twentytwok.hospitalsystem22K.common.R;
import com.twentytwok.hospitalsystem22K.util.QiNiuUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 公用接口的controller
 * @author Yuanao
 * @data 2021年11月9日 10:39:50
 */
@RestController
@RequestMapping("/api/common")
@CrossOrigin("*")
public class CommonController {

    /**
     * 获取上传到七牛云的token地址
     */
    @RequestMapping("/getUploadToken")
    public R getUploadToken() {
        String bucket = "agreeable";
        return new R(Code.OK, "获取成功", QiNiuUtils.getToken(bucket));
    }

}
